<template>
	<div>
		<router-link to="/">返回上一页</router-link>
		<div id="city"></div>
	</div>
</template>

<script>
	import md5 from "md5";
	import api from "../api/index.js"
	export default {
		props: {
			city: {
				type: String,
				default: ""
			}
		},
		mounted() {
			api.getcityData({
				city_name: this.city,
				sign: md5("appid17281city_name" + this.city + "formatjson06dfb5ae56b1d0805183511bf194a1a5")
			}).then(res => {
				console.log(res);
				if (res.status == 200) {
					var allcity = [];
					for (var i = 0; i < res.data.retdata.subList.length; i++) {
						var objexa = {
							name: res.data.retdata.subList[i].city,
							value: res.data.retdata.subList[i].curConfirm
						}
						allcity.push(objexa);
					}
					this.$charts.cityMap("city", allcity, this.city);
				}
			}).catch(error => {
				console.log(error);
			});
		}
	}
</script>

<style scoped>
	#city {
		width: 375px;
		height: 400px;
	}
</style>
